fix: support bare repo worktrees in GitWorktree widget#138
Merged
sirmalloc merged 4 commits intoMar 4, 2026
Conversation
The GitWorktree widget now correctly detects worktrees from bare repositories. Previously, it only checked for `.git/worktrees/` in the path, but bare repos store worktree metadata at `<bare-repo>/worktrees/<name>` without the `.git` prefix. This adds an additional check for `/worktrees/` pattern when the `.git/worktrees/` pattern isn't found. Fixes detection for setups like: - Bare repo at: /path/to/repo (contains objects/, refs/, HEAD, etc.) - Worktree at: /path/to/repo/trees/feature-x - Git dir: /path/to/repo/worktrees/feature-x
Owner
|
Thanks for this, it'll be published as v2.1.10 shortly |
BenIsLegit
pushed a commit
to BenIsLegit/ccstatusline-usage
that referenced
this pull request
Mar 28, 2026
* fix: support bare repo worktrees in GitWorktree widget The GitWorktree widget now correctly detects worktrees from bare repositories. Previously, it only checked for `.git/worktrees/` in the path, but bare repos store worktree metadata at `<bare-repo>/worktrees/<name>` without the `.git` prefix. This adds an additional check for `/worktrees/` pattern when the `.git/worktrees/` pattern isn't found. Fixes detection for setups like: - Bare repo at: /path/to/repo (contains objects/, refs/, HEAD, etc.) - Worktree at: /path/to/repo/trees/feature-x - Git dir: /path/to/repo/worktrees/feature-x * chore: remove accidental npm lockfile from PR branch * chore: bump version to 2.1.10 and update recent updates --------- Co-authored-by: Matthew Breedlove <sirmalloc@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The GitWorktree widget now correctly detects worktrees from bare repositories.
Previously, it only checked for
.git/worktrees/in the path, but bare repos store worktree metadata at<bare-repo>/worktrees/<name>without the.gitprefix.Before: Worktrees from bare repos showed "no git" instead of the worktree name
After: Correctly displays the worktree name
Changes
/worktrees/pattern when.git/worktrees/isn't foundTest plan
Example
Bare repo setup:
Running
git rev-parse --git-dirfromtrees/feature-x/returns/path/to/repo/worktrees/feature-x, which now correctly extractsfeature-xas the worktree name.